/**
 * Created by zhaojm on 15/3/28.
 */
game.UILayer = cc.Layer.extend({
    _score : null,
    _lifeCount : null,
    ctor:function(){
        this._super();
        var winSize = cc.winSize;
        // score
        this._score = cc.LabelBMFont.create("Score:" + game.Config.getScoreValue(), res.arial14_fnt);
        this._score.setPosition(cc.p(cc.winSize.width - 5, cc.winSize.height - 30));
        this.addChild(this._score);
        this._score.setAnchorPoint(cc.p(1, 0));
        this._score.setAlignment(cc.TEXT_ALIGNMENT_RIGHT);

        var life = new cc.Sprite(res.ship01_png, cc.rect(0, 0, 60, 38));
        life.setScale(0.6);
        life.setPosition(cc.p(30,winSize.height-23));
        this.addChild(life, 1, 5);


        this._lifeCount = new cc.LabelTTF(game.Config.getLifeCount(), "Arial", 20);
        this._lifeCount.setPosition(cc.p(60, winSize.height-20));
        this._lifeCount.setColor(new cc.Color(255, 0, 0));
        this.addChild(this._lifeCount, 1000);
        //
        //
        //CCMenuItemImage *pause = CCMenuItemImage::create("pause.png", "pause.png", this, menu_selector(GameLayer::doPause));
        //pause->setAnchorPoint(ccp(1, 0));
        //pause->setPosition(ccp(winSize.width, 0));
        //CCMenu *menu = CCMenu::create(pause, NULL);
        //menu->setAnchorPoint(ccp(0, 0));
        //addChild(menu, 1, 10);
        //menu->setPosition(CCPointZero);
    },


    doPause:function(pSender){
        //CCDirector::sharedDirector()->pause();
        //SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
        //SimpleAudioEngine::sharedEngine()->pauseAllEffects();
        //PauseLayer *pauseLayer = PauseLayer::create();
        //addChild(pauseLayer,9999);
    },

    updateUI:function(){
        this._score.setString('Score:' + game.Config.getScoreValue());
        this._lifeCount.setString(game.Config.getLifeCount());
    },

});